package cn.patpang.core.framework.hibernate;

import java.io.Serializable;

/**
 * @Title BaseDaoView.java
 * @Author PangPX
 * @Data 2017年6月8日 下午2:50:56
 */
public class BDMultiCondition implements Serializable {

    private static final long serialVersionUID = 1867017439905993431L;

    public final static String PLACEHOLDER = "_P_";

    public static enum K {

        /* AND ( ) */
        _AND(" AND "), // AND ()
        _OR(" OR "), // OR ()

        ;
        private String val;

        private K(String val) {
            this.val = val;
        }

        @Override
        public String toString() {
            return this.val;
        }

    }

    private K conditionK = K._AND;
    private BDCondition[] conditions;

    private BDMultiCondition() {
    }

    private BDMultiCondition(K conditionK, BDCondition[] conditions) {
        super();
        this.conditionK = conditionK;
        this.conditions = conditions;
    }

    public static BDMultiCondition set(BDCondition... conditions) {
        return new BDMultiCondition(K._AND, conditions);
    }

    public static BDMultiCondition set(K conditionK, BDCondition... conditions) {
        return new BDMultiCondition(conditionK, conditions);
    }

    public K getConditionK() {
        return conditionK;
    }

    public BDCondition[] getConditions() {
        return conditions;
    }

}
